package com.xoa.controller.party;

import com.xoa.model.party.FixFormWithBLOBs;
import com.xoa.service.party.FixFormService;
import com.xoa.util.common.wrapper.BaseWrapper;
import com.xoa.util.common.wrapper.BaseWrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("fixForm")
public class FixFormController {
    @Autowired
    private FixFormService fixFormService;

    @RequestMapping("insertSelective")
    public BaseWrapper insertSelective(FixFormWithBLOBs fixForm, String tbr, String lxdh, String tbsj ){
        fixForm.setItemUseid(tbr);
        fixForm.setItemUseiddatetime(tbsj);
        fixForm.setItemUseidtel(lxdh);
        return  fixFormService.insertSelective(fixForm);
    }
    @RequestMapping("updateByPrimaryKeySelective")
    public BaseWrapper updateByPrimaryKeySelective(FixFormWithBLOBs fixForm, String tbr, String lxdh, String tbsj){
        fixForm.setItemUseid(tbr);
        fixForm.setItemUseiddatetime(tbsj);
        fixForm.setItemUseidtel(lxdh);
        return  fixFormService.updateByPrimaryKeySelective(fixForm);
    }
    @RequestMapping("selectByFixFromId")
    public BaseWrapper selectByFixFromId(Integer fixFromId, HttpServletRequest request){
        return fixFormService.selectByFixFromId(fixFromId,request);
    }
    @RequestMapping("deleteByExample")
    public BaseWrapper deleteByExample(Integer fixFromId){
        return fixFormService.deleteByExample(fixFromId);
    }
    @RequestMapping("selectList")
    public BaseWrappers selectList(HttpServletRequest request, Integer page, Integer pageSize, Boolean userFlag){

        return fixFormService.selectList(request,page,pageSize,userFlag);
    }

    @RequestMapping("selectFormList")
    public BaseWrappers selectFormList(HttpServletRequest request, Integer page, Integer pageSize, Boolean userFlag, String type, String code, String gridCode){

        return fixFormService.selectFormList(request,page,pageSize,userFlag,type,code,gridCode);
    }
    @RequestMapping("selectByListFixFromId")
    public BaseWrapper selectByListFixFromId(Integer fixFromId, HttpServletRequest request, String type){

        return fixFormService.selectByListFixFromId(fixFromId,request,type);
    }
    @RequestMapping("deleteByExamplebyId")
    public BaseWrapper deleteByExamplebyId(Integer fixFromId, Integer type){
        return fixFormService.deleteByExamplebyId(fixFromId,type);
    }
    @RequestMapping("selectUnionAllType")
    public BaseWrappers selectUnionAllType(HttpServletRequest request, String itemType){
        return    fixFormService.selectUnionAllType(request,itemType);
    }

    @RequestMapping("selectUnionAll")
    public BaseWrappers selectUnionAll(HttpServletRequest request, String itemType){
        return    fixFormService.selectUnionAll(request,itemType);
    }

    @RequestMapping("selectUnionAllByname")
    public BaseWrappers selectUnionAllByname(HttpServletRequest request, HttpServletResponse response, String unitName, Integer page, Integer pageSize, Boolean userFlag, String orgName, String codeType, String area,
                                             String  number, String beginDate, String endDate, String businesSstuts, String dangerous, Integer daochu){
        return fixFormService.selectUnionAllByname(request,response,unitName,page,pageSize,userFlag,orgName,codeType,area,number,beginDate,endDate,businesSstuts,dangerous,daochu);
    }
    /**
     * 创建作者:   高亚峰
     * 创建日期:   2017年11月28日 下午15:19:05
     * 方法介绍:   查询五个种类各个的数量和总和
     * 参数说明:
     * 参数说明:   @return
     */
    @RequestMapping("selectCounts")
    public BaseWrapper selectCounts(){
        return fixFormService.selectCounts();
    }

    @RequestMapping("selectFlowCounts")
    public BaseWrapper selectFlowCounts(){
        return fixFormService.selectFlowCounts();
    }

    /**
     * 创建作者:   季佳伟
     * 创建日期:   2018年01月26日 下午15:19:05
     * 方法介绍:   统计五种企业  四种企业状态
     * 参数说明:   @param password
     * 参数说明:   @return
     */
    @RequestMapping("selectTypeCount")
    public BaseWrapper selectTypeCount(){
        return fixFormService.selectTypeCount();
    }
    /**
     * 创建作者:   高亚峰
     * 创建日期:   2017年11月28日 下午15:19:05
     * 方法介绍:   某个种类各个状态的数量和总和
     * 参数说明:   @param password
     * 参数说明:   @return
     */
    @RequestMapping("selectCountByTypeId")
    public BaseWrappers selectCountByTypeId(String typeId){
        return fixFormService.selectCountByTypeId(typeId);
    }

    @RequestMapping("/deleteByIds")
    @ResponseBody
    public BaseWrapper deleteByIds(String ids, Integer typeId){
        return  fixFormService.deleteByIds(ids,typeId);
    }
    /**
     * 创建作者:   高亚峰
     * 创建日期:   2018年01月18日 下午15:19:05
     * 方法介绍:   各个状态的数量和总和
     * 参数说明:   @param password
     * 参数说明:   @return
     */
    @RequestMapping("/getStatusCount")
    public BaseWrapper getStatusCount(){
        return fixFormService.getStatusCount();
    }


    @RequestMapping("/getUserInfo")
    public BaseWrapper getUserInfo(HttpServletRequest request){
        return fixFormService.getUserInfo(request);
    }
    @RequestMapping("/selectUnionAllByName")
    public BaseWrapper selectUnionAllByName(HttpServletRequest request, String state,
                                            @RequestParam(name = "page", required = false, defaultValue = "1") Integer page,
                                            @RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize){
        return  fixFormService.selectUnionAllByName(request,state,page,pageSize);
    }
}
